package com.ft.scan.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private int code;
    private String success;
    private String errorMsg;
    private T data;
    private Long total;

    public static <T> Result<T> ok(T data) {
        return new Result<>(200, "success", null, data, null);
    }

    public static Result fail(int code, String errorMsg) {
        return new Result(code, "fail", errorMsg, null, null);
    }

    public static Result fail(String errorMsg) {
        return new Result(500, "fail", errorMsg, null, null);
    }
}
